$(function() {
	$('.carousel').carousel({
		interval: 3000
	});
	$("#header").load('header.html', function() {
		loadHeader(2)
	});
	$("#footer").load('footer.html', function(data, status, xhr) {});
	$("#tab").load('tab.html', function(data, status, xhr) {});
	//获取url中的参数
	function getUrlParam(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
		var r = window.location.search.substr(1).match(reg); //匹配目标参数
		if(r != null) return unescape(r[2]);
		return null; //返回参数值
	}
	//接收URL中的参数
	var id = getUrlParam('HosID');
	console.log(id)
	$.ajax({
		url: host + '/MtmlAPI/SucessCaseList',
		type: 'post',
		dataType: 'JSON',
		data: {
			types: 1,
			cid: cid,
			mid: id,
			index: 1,
			size: 100
		},

		success: function(res) {
			//			typeof(res.data)=="null"?($('.case-list').append(`<div></div>`)):( obj = res.data.list)
			var obj = res.data
			if(res.state) {
				for(var i = 0; i < obj.list.length; i++) {
					var pro = obj.list[i].Operation.split(",");
					var mid = obj.list[i].mid
					console.log(mid)
					$('.case-list').append(
						`
               		<li onclick="location.href='case-detail.html?mid=${mid}'" style='width:426px;'>
					<div class="case-item-img">
						<div class="case-item-img-l">
							<img src="${obj.list[i].skulist[0].img}" height='155' width='163'/>
							<div>BEFORE</div>
						</div>
						<div class="case-item-img-l case-item-img-r">
							<div>AFTER</div>
							<img src="${obj.list[i].skulist[1].img}" height='155' width='163'/>

						</div>
					</div>
					<ul class="case-item-txt">
						<li>
							<div class="case-per">
								<div>姓名：${obj.list[i].PatientName}</div>
								<div>医生：${obj.list[i].DocName}</div>
							</div>
						</li>
						<li> 治疗前:<br /> ${obj.list[i].skulist[0].Describe}
						</li>
						<li>治疗后: <br />${obj.list[i].skulist[1].Describe}
						</li>
						<li>
							<ul class="case-project">
								<li><span>·</span><span>${pro}</span></li>
							</ul>
						</li>
					</ul>
				</li>

				`
					);

				}
			} else {
			}
		},
		error: function() {}
	});
});